package com.ccrfid.rmc6.repository.device;

import com.ccrfid.rmc6.entity.device.CardEntity;
import org.springframework.data.repository.Repository;

import java.util.List;

public interface CardRepository extends Repository<CardEntity, Long> {
    //
    CardEntity getById(Long id);
    CardEntity getByCardNumber(Long cardNumber);
    CardEntity getByHexNumber(String hexNumber);

    CardEntity getAllByHexNumber(String hexNumber);
    //
    List<CardEntity> getAllBy();
    //
    Boolean existsById(Long id);
    Boolean existsBySn(String sn);
    Boolean existsByCardNumber(Long cardNumber);
    Boolean existsBySnAndIdNot(String sn, Long id);
    Boolean existsByCardNumberAndIdNot(Long cardNumber, Long id);
    //
    CardEntity save(CardEntity entity);
    //
    void deleteById(Long id);

}
